<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of consistent</title>
  <meta name="keywords" content="consistent">
  <meta name="description" content="CONSISTENT   Check ReBEL data structures for consistentency.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../menu.html">Home</a> &gt;  <a href="#">ReBEL-0.2.7</a> &gt; <a href="#">core</a> &gt; consistent.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../menu.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="menu.html">Index for .\ReBEL-0.2.7\core&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>consistent
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>CONSISTENT   Check ReBEL data structures for consistentency.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function errstring = consistent(ds, type) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> CONSISTENT   Check ReBEL data structures for consistentency.

   errstring = consistent(ds, type) checks a data structure DS of supposed TYPE for consistency.

     See also
     <a href="gssm.html" class="code" title="function [varargout] = model_interface(func, varargin)">GSSM</a>, <a href="geninfds.html" class="code" title="function InferenceDS = geninfds(ArgDS)">GENINFDS</a>

   Copyright (c) Oregon Health &amp; Science University (2006)

   This file is part of the ReBEL Toolkit. The ReBEL Toolkit is available free for
   academic use only (see included license file) and can be obtained from
   http://choosh.csee.ogi.edu/rebel/.  Businesses wishing to obtain a copy of the
   software should contact rebel@csee.ogi.edu for commercial licensing information.

   See LICENSE (which should be part of the main toolkit distribution) for more
   detail.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="checkstructfields.html" class="code" title="function errstring = checkstructfields(ds,varargin)">checkstructfields</a>	CHECKSTRUCTFIELDS Checks if a data structure has the required fields.</li><li><a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>	STRINGMATCH  Returns match > 0 if string1 and string2 match (string2 can be a cell array of</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="convgausns.html" class="code" title="function NoiseDS = convgausns(NoiseDS, target_cov_type)">convgausns</a>	CONVGAUSNS  Convert Gaussian noise source from one cov_type to another</li><li><a href="fixinfds.html" class="code" title="function InferenceDS = fixinfds(InferenceDS)">fixinfds</a>	FIXINFDS  Fix a user generated ("hand rolled") inference data structure to make sure it meets</li><li><a href="geninfds.html" class="code" title="function InferenceDS = geninfds(ArgDS)">geninfds</a>	GENINFDS  Generate inference data structure from a generalized state space model and user defined inference parameters.</li><li><a href="gensysnoiseds.html" class="code" title="function [pNoise, oNoise, InferenceDS] = gensysnoiseds(InferenceDS, estimatorType, pNoiseAdaptMethod, pNoiseAdaptParams,oNoiseAdaptMethod, oNoiseAdaptParams)">gensysnoiseds</a>	GENSYSNOISEDS  Generate process and observation noise data structures for a given InferenceDS data structure</li><li><a href="gssm.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm</a>	GSSM  Template file for generalized state space model.</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_bft.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_bft</a>	GSSM_BFT  General state space model for Bearings and Frequency Tracking of a randomly maneuvering</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_bot.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_bot</a>	GSSM_BOT  General state space model for Bearings-Only Tracking of a randomly maneuvering</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_brt.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_brt</a>	GSSM_BRT  General state space model for Bearing-and-Range Tracking of a randomly maneuvering</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_lti1.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_lti1</a>	GSSM_LTI1  Generalized state space model for simple LTI system</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_mackey_glass.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_mackey_glass</a>	GSSM_MACKEY_GLASS  Generalized state space model for Mackey-Glass chaotic time series</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_n1.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_n1</a>	GSSM_N1  Generalized state space model for simple nonlinear system</li><li><a href="../.././ReBEL-0.2.7/examples/gssm/gssm_speech_linear.html" class="code" title="function [varargout] = model_interface(func, varargin)">gssm_speech_linear</a>	GSSM_SPEECH  Generalized state space model for single phoneme speech enhancement</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function errstring = consistent(ds, type)</a>
0002 
0003 <span class="comment">% CONSISTENT   Check ReBEL data structures for consistentency.</span>
0004 <span class="comment">%</span>
0005 <span class="comment">%   errstring = consistent(ds, type) checks a data structure DS of supposed TYPE for consistency.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%     See also</span>
0008 <span class="comment">%     GSSM, GENINFDS</span>
0009 <span class="comment">%</span>
0010 <span class="comment">%   Copyright (c) Oregon Health &amp; Science University (2006)</span>
0011 <span class="comment">%</span>
0012 <span class="comment">%   This file is part of the ReBEL Toolkit. The ReBEL Toolkit is available free for</span>
0013 <span class="comment">%   academic use only (see included license file) and can be obtained from</span>
0014 <span class="comment">%   http://choosh.csee.ogi.edu/rebel/.  Businesses wishing to obtain a copy of the</span>
0015 <span class="comment">%   software should contact rebel@csee.ogi.edu for commercial licensing information.</span>
0016 <span class="comment">%</span>
0017 <span class="comment">%   See LICENSE (which should be part of the main toolkit distribution) for more</span>
0018 <span class="comment">%   detail.</span>
0019 
0020 
0021 <span class="comment">%===============================================================================================</span>
0022 
0023 <span class="keyword">if</span> (nargin~=2)
0024   error(<span class="string">'Not enough input arguments!'</span>);
0025 <span class="keyword">end</span>
0026 
0027 <span class="keyword">if</span> ~ischar(type)
0028   error(<span class="string">'Type argument should be a string.'</span>);
0029 <span class="keyword">end</span>
0030 
0031 <span class="comment">% Assume that all is OK as default</span>
0032 errhead = [<span class="string">'  [ consistent('</span> inputname(1) <span class="string">','''</span> type <span class="string">''') ]   '</span>];
0033 
0034 errstring = <span class="string">''</span>;
0035 
0036 
0037 <span class="keyword">if</span> ~isstruct(ds)
0038   errstring = [errhead inputname(1) <span class="string">' is not a data structure.'</span>];
0039   <span class="keyword">return</span>
0040 <span class="keyword">end</span>
0041 
0042 
0043 <span class="keyword">switch</span> (type)
0044 
0045 <span class="comment">%===============================================================================================================================</span>
0046 <span class="comment">%== General State Space Model Data Structure (GSSM)</span>
0047 <span class="comment">%===============================================================================================================================</span>
0048 <span class="keyword">case</span> <span class="string">'gssm'</span>
0049 
0050   <span class="comment">%-- Check existence of required data structure fields</span>
0051   mf = <a href="checkstructfields.html" class="code" title="function errstring = checkstructfields(ds,varargin)">checkstructfields</a>(ds,<span class="string">'type'</span>,<span class="string">'tag'</span>,<span class="string">'statedim'</span>,<span class="string">'obsdim'</span>,<span class="string">'paramdim'</span>,<span class="string">'U1dim'</span>,<span class="string">'U2dim'</span>,<span class="string">'Vdim'</span>,<span class="string">'Ndim'</span>,<span class="string">'pNoise'</span>,<span class="string">'oNoise'</span>,<span class="string">'params'</span>,<span class="string">'ffun'</span>,<span class="string">'hfun'</span>,<span class="string">'setparams'</span>);
0052   <span class="keyword">if</span> ~isempty(mf), errstring = [errhead <span class="string">' Data structure does not contain the following fields : '</span> mf]; <span class="keyword">return</span>; <span class="keyword">end</span>
0053 
0054   <span class="comment">%-- Check type field</span>
0055   <span class="keyword">if</span> ~ischar(ds.type) | ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(ds.type,<span class="string">'gssm'</span>)
0056       errstring = [errhead  <span class="string">' Data structure is not of type '''</span> type <span class="string">''' or the type field is not a string'</span>];
0057       <span class="keyword">return</span>;
0058   <span class="keyword">end</span>
0059 
0060 
0061 <span class="comment">%===============================================================================================================================</span>
0062 <span class="comment">%== Inference Data Structure (InferenceDS)</span>
0063 <span class="comment">%===============================================================================================================================</span>
0064 <span class="keyword">case</span> <span class="string">'InferenceDS'</span>
0065 
0066   <span class="comment">%-- Check existence of required data structure fields</span>
0067   mf = <a href="checkstructfields.html" class="code" title="function errstring = checkstructfields(ds,varargin)">checkstructfields</a>(ds,<span class="string">'type'</span>,<span class="string">'inftype'</span>,<span class="string">'statedim'</span>,<span class="string">'obsdim'</span>,<span class="string">'U1dim'</span>,<span class="string">'U2dim'</span>,<span class="string">'Vdim'</span>,<span class="string">'Ndim'</span>, <span class="keyword">...</span>
0068                             <span class="string">'ffun'</span>,<span class="string">'hfun'</span>,<span class="string">'innovation'</span>,<span class="string">'stateAngleCompIdxVec'</span>,<span class="string">'obsAngleCompIdxVec'</span>);
0069   <span class="keyword">if</span> ~isempty(mf), errstring = [errhead <span class="string">' Data structure does not contain the following fields : '</span> mf]; <span class="keyword">return</span>; <span class="keyword">end</span>
0070 
0071   <span class="comment">%-- Check type field</span>
0072   <span class="keyword">if</span> (~ischar(ds.type) | ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(ds.type,<span class="string">'InferenceDS'</span>))
0073     errstring = [errhead  <span class="string">' Data structure is not of type '''</span> type <span class="string">''' or the type field is not a string.'</span>];
0074     <span class="keyword">return</span>;
0075   <span class="keyword">end</span>
0076 
0077   <span class="comment">%-- Check inference type field</span>
0078   <span class="keyword">if</span> ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(ds.inftype,{<span class="string">'state'</span>,<span class="string">'parameter'</span>,<span class="string">'joint'</span>})
0079     errstring = [errhead  <span class="string">' Inference type '''</span> type <span class="string">''' unknown.'</span>];
0080     <span class="keyword">return</span>;
0081   <span class="keyword">end</span>
0082 
0083 
0084 <span class="comment">%===============================================================================================================================</span>
0085 <span class="comment">%== Noise Source Data Structure (NoiseDS)</span>
0086 <span class="comment">%===============================================================================================================================</span>
0087 <span class="keyword">case</span> <span class="string">'NoiseDS'</span>
0088 
0089   <span class="comment">%-- Check existence of required data structure fields</span>
0090   mf = <a href="checkstructfields.html" class="code" title="function errstring = checkstructfields(ds,varargin)">checkstructfields</a>(ds,<span class="string">'type'</span>,<span class="string">'ns_type'</span>,<span class="string">'tag'</span>,<span class="string">'dim'</span>,<span class="string">'sample'</span>,<span class="string">'likelihood'</span>);
0091   <span class="keyword">if</span> ~isempty(mf), errstring = [errhead <span class="string">' Data structure does not contain the following fields : '</span> mf]; <span class="keyword">return</span>; <span class="keyword">end</span>
0092 
0093   <span class="comment">%-- Check type field</span>
0094   <span class="keyword">if</span> (~ischar(ds.type) | ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(ds.type,<span class="string">'NoiseDS'</span>))
0095     errstring = [errhead  <span class="string">' Data structure is not of type '''</span> type <span class="string">''' or the type field is not a string.'</span>];
0096     <span class="keyword">return</span>;
0097   <span class="keyword">end</span>
0098 
0099 
0100 <span class="comment">%===============================================================================================================================</span>
0101 <span class="keyword">otherwise</span>
0102   errstring = [errhead <span class="string">'Data structure type '</span> type <span class="string">' not supported.'</span>];
0103 <span class="keyword">end</span>
0104 
0105 <span class="keyword">return</span></pre></div>
<hr><address>Generated on Tue 26-Sep-2006 10:36:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>